const Redis = require('ioredis');

const redis = new Redis({
    port: 6379,
    host: "120.79.122.205",
    password: 'xdclass.net'
})

//封装相关类
const redisConfig = {
    set: (key, value, time) => {
        return  time ? redis.set(key, value, 'EX', time) : redis.set(key, value)
    },
    get: (key) => {
        return redis.get(key)
    },
    del: (key) => {
        return redis.del(key)
    },
    exists: (key) => {
        return redis.exists(key)
    }
}

module.exports = redisConfig